<%@ page language="java" contentType="text/html; charset=UTF-8"    import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.vo.*"
    pageEncoding="UTF-8"%>
    <%String path = request.getContextPath();%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path %>/houtai/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ //全选按钮事件
	$("#checkall").click(function(){
		var flag = $(this).prop("checked");
	    $("input[id=ck]").prop("checked",flag);
	});
});
</script>
<script type="text/javascript">//删除选中事件
   $(document).ready(function(){
	   $("#deleteall").click(function(){
		   var sks = $("input[id=ck]:checked");
		   var cids ="";
		   sks.each(function(){
			   var cid = $(this).attr("cid");
			   cids = cids+"&cid="+cid;
		   });
		   $.ajax({
			  url:"<%=path%>/ScenehomeServlet",
			  type:"post",
			  data:"method=deleteall"+cids,
			  success:function(mes){
					sks.each(function(){
					$(this).parent().parent().parent().remove();
					});
					$("#cnum").html(mes);
					}
		   });
	   });
   });
</script>
<script type="text/javascript">  //小按钮决定全选
  $(document).ready(function(){
	  $("input[id=ck]").click(function(){
		   var flag = $(this).prop("checked"); 
		 
		   if(flag==false){
			   $("#checkall").prop("checked",false);
		   }
		   else{
			    var c1 = $("input[id=ck]").length;
			    var c2 = $("input[id=ck]:checked").length;
			    if(c1==c2){
			    	$("#checkall").prop("checked",true);
			    }
			    else{
			    	$("#checkall").prop("checked",false);
			    }
		   }
		  });
	  });
  </script>
</head>

		<style type="text/css">
		#kuan{
		 margin:10px;
		 padding: 10px;
		}
		</style>
<body>
<jsp:include page="../ScenehomeServlet">
<jsp:param value="checkall" name="method"/>
</jsp:include>
	<div class="am-btn-group am-btn-group-xs">
		 <input type="checkbox"   id="checkall"  > 全选 
			  <a  id="deleteall" href="javascript:void(0);">删除选中 </a>
	</div>
              <table><tr><td></td>
                 <td>景点名称</td>
                 <td>景点简介</td>
                 <td>城市</td>
                 <td>分类</td>
                 </tr>
                 
                 <%
                 ArrayList<Scene> allscene = (ArrayList<Scene>)request.getAttribute("allcheck");
                 for(Scene scene:allscene){	
                	 %>
                	   <tr ><td id="kuan"><input id="ck" type="checkbox"    cid="<%=scene.getId()%>"></td> <td id="kuan"><%=scene.getScenename() %></td><td id="kuan"><%=scene.getIntro() %></td>
                	 <td id="kuan"><%=scene.getCity().getCityname() %></td><td id="kuan"><%=scene.getTheme().getClassname() %></td></tr>
                	
                	 <% }   %>
                 </table>

</body>
</html>